#include <iostream>
using namespace std;
class MyString
{
    private:
        int l;
        char s[100000];
    public:
        MyString            ();
        MyString            (const char * ss);
        MyString            (const char * ss,const unsigned n);
        MyString            (MyString &str);
        ~MyString           ();
        void     print      (void);
        void     append     (MyString &str);
        MyString substr     (const unsigned int i,const unsigned int n);
        MyString insert     (const unsigned int i,const char *ss);
        MyString insert     (const unsigned int i,MyString &str);
};
MyString::MyString()
{
    l=0;
    s[0]=0;
}
MyString::MyString(const char * ss)
{
    for(l=0;ss[l];s[l]=ss[l],++l);
}
MyString::MyString(const char * ss,const unsigned n)
{
    for(l=0;l<n;s[l]=ss[l],++l);
}
MyString::MyString(MyString &str)
{
    for(l=0;l<str.l;s[l]=str.s[l],++l);
}
MyString::~MyString()
{
    l=0;
}
void MyString::print(void)
{
    for(int i=0;i<l;++i)
        cout<<s[i];
}
void MyString::append(MyString &str)
{
    for(unsigned int j=0;j<str.l;s[l]=str.s[j],++l,++j);
}
MyString MyString::substr(const unsigned int i,const unsigned int n)
{
    MyString tmp(s+i,n);
    return tmp;
}
MyString MyString::insert(const unsigned int i,const char *ss)
{
    MyString tmp;
    for(unsigned int j=0;j<i;tmp.s[tmp.l]=s[j],++tmp.l,++j);
    for(unsigned int j=0;ss[j];tmp.s[tmp.l]=ss[j],++tmp.l,++j);
    for(unsigned int j=i;j<l;tmp.s[tmp.l]=s[j],++tmp.l,++j);
    return tmp;
}
MyString MyString::insert(const unsigned int i,MyString &str)
{
    MyString tmp;
    for(unsigned int j=0;j<i;tmp.s[tmp.l]=s[j],++tmp.l,++j);
    for(unsigned int j=0;j<str.l;tmp.s[tmp.l]=str.s[j],++tmp.l,++j);
    for(unsigned int j=i;j<l;tmp.s[tmp.l]=s[j],++tmp.l,++j);
    return tmp;
}


int main()
{
    MyString str1("jisuanjizhuanye1926ruanjian");
    str1.print();cout<<endl;
    MyString str2,str3,str4;
    str2=str1.substr(15,4);
    str2.print();cout<<endl;
    str3=str1.insert(15,str2);
    str3.print();cout<<endl;
    str4=str1.insert(8,str2);
    str4.print();cout<<endl;

    
    
    
    
    return 0;
}
